<?php
namespace App\Http\Controllers\Partner;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\PartnerModels\Partner;
use App\Models\PartnerModels\ApiUser;
class ApiUserController extends Controller{
	//移动端控制器
	//会员列表页面
    public function index(){

        return view('partner/mobile/index',['admin_mobile_menu'=>true]);
    }
    //会员添加页面
    public function create(){
        return view('partner/mobile/create',['admin_mobile_menu'=>true]);
    }

    //会员修改页面
    public function edit($id){
        if(intval($id) > 0){
            $soApiUser=new ApiUser();
            $data = $soApiUser->db_get(['id'=>['=',$id]]);
            return view('partner/mobile/edit',['admin_mobile_menu'=>true,'data'=>$data,]);
        }
        abort(404);
    }

    //会员详情页面
    public function view($id){
        $oPartner = new Partner();
        $config=Config('basics.pay_type');
        if(intval($id) > 0){
            $values=array(
                'a.id'=>$id,
                'a.type'=>2,
                'b.type'=>3
            );
            $data=$oPartner->listOne($values,1);
            if($data){
                // echo "<pre/>";print_r($data);exit;
                $data['pay_type_name']=$config[$data['pay_type']];
                if($data['gender']==1){
                    $data['gender']="男";
                }elseif($data['gender']==2){
                    $data['gender']="女";
                }else{
                    $data['gender']="未知";
                }
                if($data['status']==1){
                    $data['status']="开启";
                }elseif($data['status']==0){
                    $data['status']="关闭";
                }else{
                    $data['status']="已删除";
                }
            }
            return view('partner/vip/view',['admin_vip_menu'=>true,'data'=>$data]);
        }
        abort(404);
    }
}